ABC121 C - Energy Drink Collector
https://atcoder.jp/contests/abc121/tasks/abc121_c
提出
code: python
n, m = map(int, input().split())
ab = sorted(
list(map(int, input().split())) for _ in range(n)
)
tmp = 0
ans = 0
finish = False
for i in ab:
if (finish):
break
else:
for j in range(i
1
):
tmp += 1
ans += i
0
if (tmp == m):
finish = True
break
print(ans)